/**
 * 
 */
package org.vsg.stock.extension.vo;

import java.text.DecimalFormat;
import java.util.Date;

import org.vsg.stock.basic.domain.StockDailyLine;

/**
 * @author vison
 *
 */
public class ExtStockDailyLineVO {

	private DecimalFormat decFormat = new DecimalFormat("##0.000");	
	
	private StockDailyLine stockDailyLine;
	
	private double upShadowLine;
	
	private double downShadowLine;
	
	private double entity;
	
	private double entityRatio;
	
	private double upShadowLineRatio;
	
	private double downShadowLineRatio;
	
	public ExtStockDailyLineVO(StockDailyLine stockDailyLine) {
		this.stockDailyLine = stockDailyLine;
		this.entity = stockDailyLine.getClose() - stockDailyLine.getOpen();
		entity= entity==0 ? 0.01:entity;
		if (stockDailyLine.getClose() > stockDailyLine.getOpen()) {
			upShadowLine = Math.abs( stockDailyLine.getHigh() - stockDailyLine.getClose() );
			downShadowLine = Math.abs( stockDailyLine.getOpen() - stockDailyLine.getLow() );
		} else {
			upShadowLine = Math.abs( stockDailyLine.getHigh() - stockDailyLine.getOpen() );
			downShadowLine = Math.abs( stockDailyLine.getClose() - stockDailyLine.getLow() );
		}
		
		entityRatio = Double.parseDouble( decFormat.format( entity / stockDailyLine.getOpen() * 100 ) );
		
		upShadowLineRatio = Double.parseDouble( decFormat.format(upShadowLine / Math.abs( entity ) ));
		
		downShadowLineRatio = Double.parseDouble( decFormat.format ( downShadowLine / Math.abs( entity ) )) ;
	}

	public double getClose() {
		return stockDailyLine.getClose();
	}

	public Date getDate() {
		return stockDailyLine.getDate();
	}

	public short getExRights() {
		return stockDailyLine.getExRights();
	}

	public double getHigh() {
		return stockDailyLine.getHigh();
	}

	public long getId() {
		return stockDailyLine.getId();
	}

	public double getLow() {
		return stockDailyLine.getLow();
	}

	public double getOpen() {
		return stockDailyLine.getOpen();
	}

	public String getStockCode() {
		return stockDailyLine.getStockCode();
	}

	public double getTransactionValue() {
		return stockDailyLine.getTransactionValue();
	}

	public long getVol() {
		return stockDailyLine.getVol();
	}

	public double getYieldRate() {
		return stockDailyLine.getYieldRate();
	}

	public void setClose(double close) {
		stockDailyLine.setClose(close);
	}

	public void setDate(Date date) {
		stockDailyLine.setDate(date);
	}

	public void setExRights(short exRights) {
		stockDailyLine.setExRights(exRights);
	}

	public void setHigh(double high) {
		stockDailyLine.setHigh(high);
	}

	public void setId(long id) {
		stockDailyLine.setId(id);
	}

	public void setLow(double low) {
		stockDailyLine.setLow(low);
	}

	public void setOpen(double open) {
		stockDailyLine.setOpen(open);
	}

	public void setStockCode(String stockCode) {
		stockDailyLine.setStockCode(stockCode);
	}

	public void setTransactionValue(double transactionValue) {
		stockDailyLine.setTransactionValue(transactionValue);
	}

	public void setVol(long vol) {
		stockDailyLine.setVol(vol);
	}

	public void setYieldRate(double yieldRate) {
		stockDailyLine.setYieldRate(yieldRate);
	}

	public double getUpShadowLine() {
		return upShadowLine;
	}

	public void setUpShadowLine(double upShadowLine) {
		this.upShadowLine = upShadowLine;
	}

	public double getDownShadowLine() {
		return downShadowLine;
	}

	public void setDownShadowLine(double downShadowLine) {
		this.downShadowLine = downShadowLine;
	}

	public double getEntity() {
		return entity;
	}

	public void setEntity(double entity) {
		this.entity = entity;
	}

	public double getEntityRatio() {
		return entityRatio;
	}

	public void setEntityRatio(double entityRatio) {
		this.entityRatio = entityRatio;
	}

	public double getUpShadowLineRatio() {
		return upShadowLineRatio;
	}

	public void setUpShadowLineRatio(double upShadowLineRatio) {
		this.upShadowLineRatio = upShadowLineRatio;
	}

	public double getDownShadowLineRatio() {
		return downShadowLineRatio;
	}

	public void setDownShadowLineRatio(double downShadowLineRatio) {
		this.downShadowLineRatio = downShadowLineRatio;
	}

	

}
